home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / os.402 < prev    next >
Text File  |  1992-02-06  |  2KB  |  42 lines

  1. {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
  2. \paperw9840
  3. \paperh6720
  4. \margl120
  5. \margr120
  6. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ul0\fs24 Q:  What's a shlib, and how does it affect me?\
  7. \
  8. A:  A shlib is a shared library.  It is a library that contains object code that several executable files may use simultaneously.   When a program is linked or compiled with a shared library, the library code that defines the external references are not copied into the object file.  Instead it binds the address to a branch table which points to the actual code.\
  9. \
  10. Shared libraries help save disk storage because the a.out files don't contain copies of the archive.  It also saves memory at runtime because the a.out files point to one copy of the code.  It helps to keep all applications up to date, because when a shared library is replaced, all applications will use the new version without needing to be recompiled.  Unfortunately,  it is harder to maintain a shared library because there are more things that need to remain constant in order for new versions to be compatible.\
  11. \
  12. There are two parts in a shared library, the host library and the runtime library.  The host library gets linked in at compile time.  It's something like 
  13. \b /usr/lib/libNeXT_s.a
  14. \b0 .  (Note that there shoud also be a regular archive library that has all the profiling information in it -- 
  15. \b /usr/lib/libNeXT_p.a
  16. \b0 .)  The runtime or target library contains the branch table and the actual code.  It must be installed on the machine in order for the application to execute.  It's something like 
  17. \b /usr/shlib/libNeXT_s.C.shlib
  18. \b0 .  In this particular case,  
  19. \b C 
  20. \b0 is the version letter.\
  21. \
  22. When compiled with 
  23. \b -lNeXT_s
  24. \b0 , an a.out will contain the name of the file that it needs to use at runtime.  The 
  25. \b otool
  26. \b0  program, with the 
  27. \b -L
  28. \b0  option, will show which runtime libraries it expects.  (See the 
  29. \b otool
  30. \b0  man page.)\
  31. \
  32. The first application that touches the shared library pulls it into memory.  All others after that will point to that copy in memory.\
  33. \
  34. For related information, read the section "Using Shared Libraries" in the "Tools" chapter of the 1.0 Technical Documentation (page 33 of /NextLibrary/Documentation/NeXT/SysRefMan/18_Tools.wn).\
  35. \
  36. QA402\
  37. \
  38. Valid for 1.0 \
  39. Valid for 2.0\
  40. \
  41.  
  42.